package com.yanqu.road.entity.activity.unionwar;

import com.alibaba.fastjson.JSON;
import com.yanqu.road.entity.DataObject;
import com.yanqu.road.entity.FieldTypeAnnotation;
import com.yanqu.road.entity.union.UnionBaseInfo;

import java.util.Objects;

/**
 * 商会战-区服商会参赛名单
 */
@FieldTypeAnnotation(tableName = "t_u_activity_unionwar_union")
public class UnionWarUnionJoin extends DataObject {

    /**
     * 活动id
     */
    @FieldTypeAnnotation(select = true, update = true, desc = "活动id")
    private int activityId;
    /**
     * 商会id
     */
    @FieldTypeAnnotation(update = true, desc = "商会id")
    private String unionUid;
    /**
     * 排名（活动初始本服排名）
     */
    @FieldTypeAnnotation(desc = "初始排名")
    private int  rankNum;
    /**
     * 商会基础信息
     */
    @FieldTypeAnnotation(desc = "商会基础信息")
    private UnionBaseInfo unionBaseInfo;
    /**
     * 推送跨服结果
     */
    @FieldTypeAnnotation(desc = "推送跨服结果")
    private boolean pushSuccess;
    /**
     * 积分赛阶段积分
     */
    @FieldTypeAnnotation(desc = "积分赛阶段积分")
    private long phaseOneScore;
    /**
     * 积分赛阶段排名
     */
    @FieldTypeAnnotation(desc = "积分赛阶段排名")
    private int phaseOneRank;
    /**
     * 决赛阶段积分
     */
    @FieldTypeAnnotation(desc = "决赛阶段积分")
    private long phaseTwoScore;
    /**
     * 决赛阶段排名
     */
    @FieldTypeAnnotation(desc = "决赛阶段排名")
    private int phaseTwoRank;

    @FieldTypeAnnotation(desc = "是否需要同步")
    private boolean needSync;

    @FieldTypeAnnotation(desc = "分组id")
    private int groupId;

    public int getActivityId() {
        return activityId;
    }

    public void setActivityId(int activityId) {
        if(this.activityId != activityId) {
            this.activityId = activityId;
            setUpdateOption();
        }
    }

    public String getUnionUid() {
        return unionUid;
    }

    public void setUnionUid(String unionUid) {
        if(!Objects.equals(this.unionUid, unionUid)) {
            this.unionUid = unionUid;
            setUpdateOption();
        }
    }

    public int getRankNum() {
        return rankNum;
    }

    public void setRankNum(int rankNum) {
        if(this.rankNum != rankNum) {
            this.rankNum = rankNum;
            setUpdateOption();
        }
    }

    public String getUnionBaseInfoJsonStr(){
        if(null == unionBaseInfo){
            return "";
        }else {
            return JSON.toJSONString(unionBaseInfo);
        }
    }

    public UnionBaseInfo getUnionBaseInfo() {
        return unionBaseInfo;
    }

    public void setUnionBaseInfo(UnionBaseInfo unionBaseInfo) {
        this.unionBaseInfo = unionBaseInfo;
        setUpdateOption();
    }

    public boolean isPushSuccess() {
        return pushSuccess;
    }

    public void setPushSuccess(boolean pushSuccess) {
        if(this.pushSuccess != pushSuccess) {
            this.pushSuccess = pushSuccess;
            setUpdateOption();
        }
    }

    public long getPhaseOneScore() {
        return phaseOneScore;
    }

    public void setPhaseOneScore(long phaseOneScore) {
        if(this.phaseOneScore != phaseOneScore) {
            this.phaseOneScore = phaseOneScore;
            setUpdateOption();
        }
    }

    public int getPhaseOneRank() {
        return phaseOneRank;
    }

    public void setPhaseOneRank(int phaseOneRank) {
        if(this.phaseOneRank != phaseOneRank) {
            this.phaseOneRank = phaseOneRank;
            setUpdateOption();
        }
    }

    public long getPhaseTwoScore() {
        return phaseTwoScore;
    }

    public void setPhaseTwoScore(long phaseTwoScore) {
        if(this.phaseTwoScore != phaseTwoScore) {
            this.phaseTwoScore = phaseTwoScore;
            setUpdateOption();
        }
    }

    public int getPhaseTwoRank() {
        return phaseTwoRank;
    }

    public void setPhaseTwoRank(int phaseTwoRank) {
        if(this.phaseTwoRank != phaseTwoRank) {
            this.phaseTwoRank = phaseTwoRank;
            setUpdateOption();
        }
    }

    public boolean isNeedSync() {
        return needSync;
    }

    public void setNeedSync(boolean needSync) {
        if(this.needSync != needSync) {
            this.needSync = needSync;
            setUpdateOption();
        }
    }

    public int getGroupId() {
        return groupId;
    }

    public void setGroupId(int groupId) {
        if(this.groupId != groupId) {
            this.groupId = groupId;
            setUpdateOption();
        }
    }
}
